<template>
	<view>
		<scroll-view class="scroll-content " scroll-y="true" :style="{ height: computedScrollViewHeight }">

			<!-- <u-cell-group v-for="(item, index) in list" :key="index" >
					<u-cell-item :arrow="true" @click="navTo('smck?id='+item.id+'&ccode='+item.ccode+'&cinvcode='+item.cinvcode+'&cinvname='+item.cinvname+'&inum='+item.inum+'&qty='+item.qty+'&iinvexchrate='+item.iinvexchrate)">
						<view slot="label" class="u-font-lg">
							<view class="padding-bottom-sm text-bold"><text><text class="text-bold">{{index+1}}、</text>出库单号：{{item.ccode}}</text></view>
							<view class="padding-bottom-sm"><text >存货名称：{{item.cinvname}}</text></view>
						</view>
					</u-cell-item>
					<u-line color="blue" />
			</u-cell-group> -->
			<view class="scroll-content" ref="scrollContent" style="
			  display: flex;
			  flex-direction: column;
			  justify-content: space-between;
			" :style="{ height: computedScrollViewHeight  }">
			<view v-for="(item,index) in list" class="cu-item shadow " :key="item.index"
				@click="navTo(item)">
				<view class="cu-form-group" style="display: flex;justify-content: space-between;">
					<view
						style=" display: inline-block;padding: 5px;background: #3E97B0;color: #fff;min-width: 40px;text-align: center;font-style: italic;font-weight: bold">
						{{ index + 1 }}
					</view>
					<view class="text-red text-bold"> {{ item.ccode|| ""  }}</view>
				</view>
				<!-- <view class="cu-form-group">
					<view class="title">出库单号：</view>
					<view style="flex: 1;"> {{ item.ccode|| ""  }} </view>
				</view> -->
				<view class="cu-form-group">
					<view class="title">存货名称：</view>
					<view style="flex: 1;"> {{ item.cinvname|| ""  }}<br /> {{ item.inum && item.inum + '箱'}} {{ item.qty && item.qty + '盒'}}</view>
				</view>
			</view>
			<u-empty v-if="!list.length"></u-empty>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{}],
			}
		},
		onShow() {
			this.loadBody();
		},
		onLoad(data) {
			this.ccode = data.ccode;
			this.loadBody();
		},
		computed: {
			computedScrollViewHeight() {
				return this.scrollViewHeight === 'auto' ? 'auto' : `${this.scrollViewHeight}px`;
			},
		},
		methods: {
			/** 设置主表信息 */
			loadBody() {
				var query = {
					"code": this.ccode
				}
				var _this = this;
				this.$u.api.zgz.findRdrsInum(query).then(res => {
					if (res.result == 'true') {
						_this.list = res.data;
					}else{
						uni.navigateBack();
					}
				});
			},
			navTo(item) {
				
				const url = 'newSmck?id='+item.id+'&ccode='+item.ccode+'&cinvcode='+item.cinvcode+'&cinvname='+item.cinvname+'&inum='+item.inum+'&qty='+item.qty+'&iinvexchrate='+item.iinvexchrate
				uni.navigateTo({
					url: url
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
	.text-border {
		border: 2px solid rgb(170, 170, 170);
		border-radius: 5px;
		position: relative;
		padding-top: 20rpx;
		margin-top: 40rpx;
		padding-left: 20rpx;

		.text {
			position: absolute;
			background-color: #fff;
			padding: 10rpx 10rpx;
			top: -25rpx;
			right: 30rpx;
		}
	}

	.custom-style {
		// background-color: rgba(25, 190, 107, 0.7);

	}

	.text-xxl {
		font-size: 60rpx;
	}

	.cu-bar {
		min-height: 60px;
	}

	.cu-btn {
		font-size: 16px;
		height: 40px;
	}

	.foot {
		background: #fff;
	}

	.cu-item {
		flex-wrap: wrap;
		padding: 8px 15px !important;
	}

	.title {
		width: 200rpx;
	}

	.cu-modal-slot {
		margin: 42rpx 32rpx 20rpx 32rpx;
		height: 100vh;
		position: relative;
	}

	.cu-modal-header {
		font-size: 38rpx;
		color: #3d3d3d;
		line-height: 40rpx;
		text-align: left;
		font-weight: 500;
	}

	.button {
		font-size: 32rpx;
		color: #666666;
		line-height: 40rpx;
		padding: 12rpx 40rpx;
		margin-bottom: 20rpx;
		background: #e2e2e2;
		border-radius: 180rpx;
	}

	.button:hover {
		background: #3e97b0;
		color: #ffffff;
	}

	.cu-modal-search-title {
		margin: 32rpx 0rpx 20rpx 0rpx;
		text-align: left;
		font-size: 32rpx;
		color: #999999;
		line-height: 40rpx;
	}

	.cu-dialog {
		background: #ffffff;
	}

	.cu-modal-footer {
		padding: 32rpx 32rpx;
		width: 100%;

		.cu-btn {
			width: 50%;
		}
	}

	.bg-confirm {
		background: #3e97b0;
		color: #ffffff;
	}
</style>